//
//  Currying_VC.swift
//  APSwift
//
//  Created by AbnerPei on 2021/11/8.
//

import UIKit

class Currying_VC: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        let sum = add(2, 3)
        print("add'sum \(sum)")
        
        let sum1 = add1(2)(3)
        print("add1'sum1 is \(sum1)")
    }
    
    func add(_ num1: Int, _ num2: Int) -> Int {
        return num1 + num2
    }
    
    /// MARK: 柯里化
    func add1(_ num: Int) -> (Int) -> Int {
        return {$0 + num}
    }

}
